#ifndef THINK_THINK_TEMPLATE_TAGLIB_CX_H
#define THINK_THINK_TEMPLATE_TAGLIB_CX_H

static char* think_template_taglib_cx =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: liu21st <liu21st@gmail.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think\\template\\taglib;\n"
	"\n"
	"use think\\template\\TagLib;\n"
	"\n"
	"/**\n"
	" * CX标签库解析类\n"
	" * @category   Think\n"
	" * @package  Think\n"
	" * @subpackage  Driver.Taglib\n"
	" * @author    liu21st <liu21st@gmail.com>\n"
	" */\n"
	"class Cx extends Taglib\n"
	"{\n"
	"\n"
	"    // 标签定义\n"
	"    protected $tags = [\n"
	"        // 标签定义： attr 属性列表 close 是否闭合（0 或者1 默认1） alias 标签别名 level 嵌套层次\n"
	"        \'php\'        => [\'attr\' => \'\'],\n"
	"        \'volist\'     => [\'attr\' => \'name,id,offset,length,key,mod\', \'alias\' => \'iterate\'],\n"
	"        \'foreach\'    => [\'attr\' => \'name,id,item,key,offset,length,mod\', \'expression\' => true],\n"
	"        \'if\'         => [\'attr\' => \'condition\', \'expression\' => true],\n"
	"        \'elseif\'     => [\'attr\' => \'condition\', \'close\' => 0, \'expression\' => true],\n"
	"        \'else\'       => [\'attr\' => \'\', \'close\' => 0],\n"
	"        \'switch\'     => [\'attr\' => \'name\', \'expression\' => true],\n"
	"        \'case\'       => [\'attr\' => \'value,break\', \'expression\' => true],\n"
	"        \'default\'    => [\'attr\' => \'\', \'close\' => 0],\n"
	"        \'compare\'    => [\'attr\' => \'name,value,type\', \'alias\' => [\'eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq\', \'type\']],\n"
	"        \'range\'      => [\'attr\' => \'name,value,type\', \'alias\' => [\'in,notin,between,notbetween\', \'type\']],\n"
	"        \'empty\'      => [\'attr\' => \'name\'],\n"
	"        \'notempty\'   => [\'attr\' => \'name\'],\n"
	"        \'present\'    => [\'attr\' => \'name\'],\n"
	"        \'notpresent\' => [\'attr\' => \'name\'],\n"
	"        \'defined\'    => [\'attr\' => \'name\'],\n"
	"        \'notdefined\' => [\'attr\' => \'name\'],\n"
	"        \'load\'       => [\'attr\' => \'file,href,type,value,basepath\', \'close\' => 0, \'alias\' => [\'import,css,js\', \'type\']],\n"
	"        \'assign\'     => [\'attr\' => \'name,value\', \'close\' => 0],\n"
	"        \'define\'     => [\'attr\' => \'name,value\', \'close\' => 0],\n"
	"        \'for\'        => [\'attr\' => \'start,end,name,comparison,step\'],\n"
	"        \'url\'        => [\'attr\' => \'link,vars,suffix,domain\', \'close\' => 0, \'expression\' => true],\n"
	"        \'function\'   => [\'attr\' => \'name,vars,use,call\'],\n"
	"    ];\n"
	"\n"
	"    /**\n"
	"     * php标签解析\n"
	"     * 格式：\n"
	"     * {php}echo $name{/php}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagPhp($tag, $content)\n"
	"    {\n"
	"        $parseStr = \'<?php \' . $content . \' ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * volist标签解析 循环输出数据集\n"
	"     * 格式：\n"
	"     * {volist name=\"userList\" id=\"user\" empty=\"\"}\n"
	"     * {user.username}\n"
	"     * {user.email}\n"
	"     * {/volist}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string|void\n"
	"     */\n"
	"    public function tagVolist($tag, $content)\n"
	"    {\n"
	"        $name   = $tag[\'name\'];\n"
	"        $id     = $tag[\'id\'];\n"
	"        $empty  = isset($tag[\'empty\']) ? $tag[\'empty\'] : \'\';\n"
	"        $key    = !empty($tag[\'key\']) ? $tag[\'key\'] : \'i\';\n"
	"        $mod    = isset($tag[\'mod\']) ? $tag[\'mod\'] : \'2\';\n"
	"        $offset = !empty($tag[\'offset\']) && is_numeric($tag[\'offset\']) ? intval($tag[\'offset\']) : 0;\n"
	"        $length = !empty($tag[\'length\']) && is_numeric($tag[\'length\']) ? intval($tag[\'length\']) : \'null\';\n"
	"        // 允许使用函数设定数据集 <volist name=\":fun(\'arg\')\" id=\"vo\">{$vo.name}</volist>\n"
	"        $parseStr = \'<?php \';\n"
	"        $flag     = substr($name, 0, 1);\n"
	"        if (\':\' == $flag) {\n"
	"            $name = $this->autoBuildVar($name);\n"
	"            $parseStr .= \'$_result=\' . $name . \';\';\n"
	"            $name = \'$_result\';\n"
	"        } else {\n"
	"            $name = $this->autoBuildVar($name);\n"
	"        }\n"
	"\n"
	"        $parseStr .= \'if(is_array(\' . $name . \') || \' . $name . \' instanceof \\think\\Collection || \' . $name . \' instanceof \\think\\Paginator): $\' . $key . \' = 0;\';\n"
	"        // 设置了输出数组长度\n"
	"        if (0 != $offset || \'null\' != $length) {\n"
	"            $parseStr .= \'$__LIST__ = is_array(\' . $name . \') ? array_slice(\' . $name . \',\' . $offset . \',\' . $length . \', true) : \' . $name . \'->slice(\' . $offset . \',\' . $length . \', true); \';\n"
	"        } else {\n"
	"            $parseStr .= \' $__LIST__ = \' . $name . \';\';\n"
	"        }\n"
	"        $parseStr .= \'if( count($__LIST__)==0 ) : echo \"\' . $empty . \'\" ;\';\n"
	"        $parseStr .= \'else: \';\n"
	"        $parseStr .= \'foreach($__LIST__ as $key=>$\' . $id . \'): \';\n"
	"        $parseStr .= \'$mod = ($\' . $key . \' % \' . $mod . \' );\';\n"
	"        $parseStr .= \'++$\' . $key . \';?>\';\n"
	"        $parseStr .= $content;\n"
	"        $parseStr .= \'<?php endforeach; endif; else: echo \"\' . $empty . \'\" ;endif; ?>\';\n"
	"\n"
	"        if (!empty($parseStr)) {\n"
	"            return $parseStr;\n"
	"        }\n"
	"        return;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * foreach标签解析 循环输出数据集\n"
	"     * 格式：\n"
	"     * {foreach name=\"userList\" id=\"user\" key=\"key\" index=\"i\" mod=\"2\" offset=\"3\" length=\"5\" empty=\"\"}\n"
	"     * {user.username}\n"
	"     * {/foreach}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string|void\n"
	"     */\n"
	"    public function tagForeach($tag, $content)\n"
	"    {\n"
	"        // 直接使用表达式\n"
	"        if (!empty($tag[\'expression\'])) {\n"
	"            $expression = ltrim(rtrim($tag[\'expression\'], \')\'), \'(\');\n"
	"            $expression = $this->autoBuildVar($expression);\n"
	"            $parseStr   = \'<?php foreach(\' . $expression . \'): ?>\';\n"
	"            $parseStr .= $content;\n"
	"            $parseStr .= \'<?php endforeach; ?>\';\n"
	"            return $parseStr;\n"
	"        }\n"
	"        $name   = $tag[\'name\'];\n"
	"        $key    = !empty($tag[\'key\']) ? $tag[\'key\'] : \'key\';\n"
	"        $item   = !empty($tag[\'id\']) ? $tag[\'id\'] : $tag[\'item\'];\n"
	"        $empty  = isset($tag[\'empty\']) ? $tag[\'empty\'] : \'\';\n"
	"        $offset = !empty($tag[\'offset\']) && is_numeric($tag[\'offset\']) ? intval($tag[\'offset\']) : 0;\n"
	"        $length = !empty($tag[\'length\']) && is_numeric($tag[\'length\']) ? intval($tag[\'length\']) : \'null\';\n"
	"\n"
	"        $parseStr = \'<?php \';\n"
	"        // 支持用函数传数组\n"
	"        if (\':\' == substr($name, 0, 1)) {\n"
	"            $var  = \'$_\' . uniqid();\n"
	"            $name = $this->autoBuildVar($name);\n"
	"            $parseStr .= $var . \'=\' . $name . \'; \';\n"
	"            $name = $var;\n"
	"        } else {\n"
	"            $name = $this->autoBuildVar($name);\n"
	"        }\n"
	"        $parseStr .= \'if(is_array(\' . $name . \') || \' . $name . \' instanceof \\think\\Collection || \' . $name . \' instanceof \\think\\Paginator): \';\n"
	"        // 设置了输出数组长度\n"
	"        if (0 != $offset || \'null\' != $length) {\n"
	"            if (!isset($var)) {\n"
	"                $var = \'$_\' . uniqid();\n"
	"            }\n"
	"            $parseStr .= $var . \' = is_array(\' . $name . \') ? array_slice(\' . $name . \',\' . $offset . \',\' . $length . \', true) : \' . $name . \'->slice(\' . $offset . \',\' . $length . \', true); \';\n"
	"        } else {\n"
	"            $var = &$name;\n"
	"        }\n"
	"\n"
	"        $parseStr .= \'if( count(\' . $var . \')==0 ) : echo \"\' . $empty . \'\" ;\';\n"
	"        $parseStr .= \'else: \';\n"
	"\n"
	"        // 设置了索引项\n"
	"        if (isset($tag[\'index\'])) {\n"
	"            $index = $tag[\'index\'];\n"
	"            $parseStr .= \'$\' . $index . \'=0; \';\n"
	"        }\n"
	"        $parseStr .= \'foreach(\' . $var . \' as $\' . $key . \'=>$\' . $item . \'): \';\n"
	"        // 设置了索引项\n"
	"        if (isset($tag[\'index\'])) {\n"
	"            $index = $tag[\'index\'];\n"
	"            if (isset($tag[\'mod\'])) {\n"
	"                $mod = (int) $tag[\'mod\'];\n"
	"                $parseStr .= \'$mod = ($\' . $index . \' % \' . $mod . \'); \';\n"
	"            }\n"
	"            $parseStr .= \'++$\' . $index . \'; \';\n"
	"        }\n"
	"        $parseStr .= \'?>\';\n"
	"        // 循环体中的内容\n"
	"        $parseStr .= $content;\n"
	"        $parseStr .= \'<?php endforeach; endif; else: echo \"\' . $empty . \'\" ;endif; ?>\';\n"
	"\n"
	"        if (!empty($parseStr)) {\n"
	"            return $parseStr;\n"
	"        }\n"
	"        return;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * if标签解析\n"
	"     * 格式：\n"
	"     * {if condition=\" $a eq 1\"}\n"
	"     * {elseif condition=\"$a eq 2\" /}\n"
	"     * {else /}\n"
	"     * {/if}\n"
	"     * 表达式支持 eq neq gt egt lt elt == > >= < <= or and || &&\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagIf($tag, $content)\n"
	"    {\n"
	"        $condition = !empty($tag[\'expression\']) ? $tag[\'expression\'] : $tag[\'condition\'];\n"
	"        $condition = $this->parseCondition($condition);\n"
	"        $parseStr  = \'<?php if(\' . $condition . \'): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * elseif标签解析\n"
	"     * 格式：见if标签\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagElseif($tag, $content)\n"
	"    {\n"
	"        $condition = !empty($tag[\'expression\']) ? $tag[\'expression\'] : $tag[\'condition\'];\n"
	"        $condition = $this->parseCondition($condition);\n"
	"        $parseStr  = \'<?php elseif(\' . $condition . \'): ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * else标签解析\n"
	"     * 格式：见if标签\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagElse($tag)\n"
	"    {\n"
	"        $parseStr = \'<?php else: ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * switch标签解析\n"
	"     * 格式：\n"
	"     * {switch name=\"a.name\"}\n"
	"     * {case value=\"1\" break=\"false\"}1{/case}\n"
	"     * {case value=\"2\" }2{/case}\n"
	"     * {default /}other\n"
	"     * {/switch}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagSwitch($tag, $content)\n"
	"    {\n"
	"        $name     = !empty($tag[\'expression\']) ? $tag[\'expression\'] : $tag[\'name\'];\n"
	"        $name     = $this->autoBuildVar($name);\n"
	"        $parseStr = \'<?php switch(\' . $name . \'): ?>\' . $content . \'<?php endswitch; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * case标签解析 需要配合switch才有效\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagCase($tag, $content)\n"
	"    {\n"
	"        $value = isset($tag[\'expression\']) ? $tag[\'expression\'] : $tag[\'value\'];\n"
	"        $flag  = substr($value, 0, 1);\n"
	"        if (\'$\' == $flag || \':\' == $flag) {\n"
	"            $value = $this->autoBuildVar($value);\n"
	"            $value = \'case \' . $value . \':\';\n"
	"        } elseif (strpos($value, \'|\')) {\n"
	"            $values = explode(\'|\', $value);\n"
	"            $value  = \'\';\n"
	"            foreach ($values as $val) {\n"
	"                $value .= \'case \"\' . addslashes($val) . \'\":\';\n"
	"            }\n"
	"        } else {\n"
	"            $value = \'case \"\' . $value . \'\":\';\n"
	"        }\n"
	"        $parseStr = \'<?php \' . $value . \' ?>\' . $content;\n"
	"        $isBreak  = isset($tag[\'break\']) ? $tag[\'break\'] : \'\';\n"
	"        if (\'\' == $isBreak || $isBreak) {\n"
	"            $parseStr .= \'<?php break; ?>\';\n"
	"        }\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * default标签解析 需要配合switch才有效\n"
	"     * 使用： {default /}ddfdf\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagDefault($tag)\n"
	"    {\n"
	"        $parseStr = \'<?php default: ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * compare标签解析\n"
	"     * 用于值的比较 支持 eq neq gt lt egt elt heq nheq 默认是eq\n"
	"     * 格式： {compare name=\"\" type=\"eq\" value=\"\" }content{/compare}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagCompare($tag, $content)\n"
	"    {\n"
	"        $name  = $tag[\'name\'];\n"
	"        $value = $tag[\'value\'];\n"
	"        $type  = isset($tag[\'type\']) ? $tag[\'type\'] : \'eq\'; // 比较类型\n"
	"        $name  = $this->autoBuildVar($name);\n"
	"        $flag  = substr($value, 0, 1);\n"
	"        if (\'$\' == $flag || \':\' == $flag) {\n"
	"            $value = $this->autoBuildVar($value);\n"
	"        } else {\n"
	"            $value = \'\\\'\' . $value . \'\\\'\';\n"
	"        }\n"
	"        switch ($type) {\n"
	"            case \'equal\':\n"
	"                $type = \'eq\';\n"
	"                break;\n"
	"            case \'notequal\':\n"
	"                $type = \'neq\';\n"
	"                break;\n"
	"        }\n"
	"        $type     = $this->parseCondition(\' \' . $type . \' \');\n"
	"        $parseStr = \'<?php if(\' . $name . \' \' . $type . \' \' . $value . \'): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * range标签解析\n"
	"     * 如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外\n"
	"     * 格式： {range name=\"var|function\"  value=\"val\" type=\'in|notin\' }content{/range}\n"
	"     * example: {range name=\"a\"  value=\"1,2,3\" type=\'in\' }content{/range}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagRange($tag, $content)\n"
	"    {\n"
	"        $name  = $tag[\'name\'];\n"
	"        $value = $tag[\'value\'];\n"
	"        $type  = isset($tag[\'type\']) ? $tag[\'type\'] : \'in\'; // 比较类型\n"
	"\n"
	"        $name = $this->autoBuildVar($name);\n"
	"        $flag = substr($value, 0, 1);\n"
	"        if (\'$\' == $flag || \':\' == $flag) {\n"
	"            $value = $this->autoBuildVar($value);\n"
	"            $str   = \'is_array(\' . $value . \')?\' . $value . \':explode(\\\',\\\',\' . $value . \')\';\n"
	"        } else {\n"
	"            $value = \'\"\' . $value . \'\"\';\n"
	"            $str   = \'explode(\\\',\\\',\' . $value . \')\';\n"
	"        }\n"
	"        if (\'between\' == $type) {\n"
	"            $parseStr = \'<?php $_RANGE_VAR_=\' . $str . \';if(\' . $name . \'>= $_RANGE_VAR_[0] && \' . $name . \'<= $_RANGE_VAR_[1]):?>\' . $content . \'<?php endif; ?>\';\n"
	"        } elseif (\'notbetween\' == $type) {\n"
	"            $parseStr = \'<?php $_RANGE_VAR_=\' . $str . \';if(\' . $name . \'<$_RANGE_VAR_[0] || \' . $name . \'>$_RANGE_VAR_[1]):?>\' . $content . \'<?php endif; ?>\';\n"
	"        } else {\n"
	"            $fun      = (\'in\' == $type) ? \'in_array\' : \'!in_array\';\n"
	"            $parseStr = \'<?php if(\' . $fun . \'((\' . $name . \'), \' . $str . \')): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        }\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * present标签解析\n"
	"     * 如果某个变量已经设置 则输出内容\n"
	"     * 格式： {present name=\"\" }content{/present}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagPresent($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $name     = $this->autoBuildVar($name);\n"
	"        $parseStr = \'<?php if(isset(\' . $name . \')): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * notpresent标签解析\n"
	"     * 如果某个变量没有设置，则输出内容\n"
	"     * 格式： {notpresent name=\"\" }content{/notpresent}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagNotpresent($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $name     = $this->autoBuildVar($name);\n"
	"        $parseStr = \'<?php if(!isset(\' . $name . \')): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * empty标签解析\n"
	"     * 如果某个变量为empty 则输出内容\n"
	"     * 格式： {empty name=\"\" }content{/empty}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagEmpty($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $name     = $this->autoBuildVar($name);\n"
	"        $parseStr = \'<?php if(empty(\' . $name . \') || ((\' . $name . \' instanceof \\think\\Collection || \' . $name . \' instanceof \\think\\Paginator ) && \' . $name . \'->isEmpty())): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * notempty标签解析\n"
	"     * 如果某个变量不为empty 则输出内容\n"
	"     * 格式： {notempty name=\"\" }content{/notempty}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagNotempty($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $name     = $this->autoBuildVar($name);\n"
	"        $parseStr = \'<?php if(!(empty(\' . $name . \') || ((\' . $name . \' instanceof \\think\\Collection || \' . $name . \' instanceof \\think\\Paginator ) && \' . $name . \'->isEmpty()))): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 判断是否已经定义了该常量\n"
	"     * {defined name=\'TXT\'}已定义{/defined}\n"
	"     * @param array $tag\n"
	"     * @param string $content\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagDefined($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $parseStr = \'<?php if(defined(\"\' . $name . \'\")): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 判断是否没有定义了该常量\n"
	"     * {notdefined name=\'TXT\'}已定义{/notdefined}\n"
	"     * @param array $tag\n"
	"     * @param string $content\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagNotdefined($tag, $content)\n"
	"    {\n"
	"        $name     = $tag[\'name\'];\n"
	"        $parseStr = \'<?php if(!defined(\"\' . $name . \'\")): ?>\' . $content . \'<?php endif; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * load 标签解析 {load file=\"/static/js/base.js\" /}\n"
	"     * 格式：{load file=\"/static/css/base.css\" /}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagLoad($tag, $content)\n"
	"    {\n"
	"        $file     = isset($tag[\'file\']) ? $tag[\'file\'] : $tag[\'href\'];\n"
	"        $type     = isset($tag[\'type\']) ? strtolower($tag[\'type\']) : \'\';\n"
	"        $parseStr = \'\';\n"
	"        $endStr   = \'\';\n"
	"        // 判断是否存在加载条件 允许使用函数判断(默认为isset)\n"
	"        if (isset($tag[\'value\'])) {\n"
	"            $name = $tag[\'value\'];\n"
	"            $name = $this->autoBuildVar($name);\n"
	"            $name = \'isset(\' . $name . \')\';\n"
	"            $parseStr .= \'<?php if(\' . $name . \'): ?>\';\n"
	"            $endStr = \'<?php endif; ?>\';\n"
	"        }\n"
	"\n"
	"        // 文件方式导入\n"
	"        $array = explode(\',\', $file);\n"
	"        foreach ($array as $val) {\n"
	"            $type = strtolower(substr(strrchr($val, \'.\'), 1));\n"
	"            switch ($type) {\n"
	"                case \'js\':\n"
	"                    $parseStr .= \'<script type=\"text/javascript\" src=\"\' . $val . \'\"></script>\';\n"
	"                    break;\n"
	"                case \'css\':\n"
	"                    $parseStr .= \'<link rel=\"stylesheet\" type=\"text/css\" href=\"\' . $val . \'\" />\';\n"
	"                    break;\n"
	"                case \'php\':\n"
	"                    $parseStr .= \'<?php include \"\' . $val . \'\"; ?>\';\n"
	"                    break;\n"
	"            }\n"
	"        }\n"
	"        return $parseStr . $endStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * assign标签解析\n"
	"     * 在模板中给某个变量赋值 支持变量赋值\n"
	"     * 格式： {assign name=\"\" value=\"\" /}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagAssign($tag, $content)\n"
	"    {\n"
	"        $name = $this->autoBuildVar($tag[\'name\']);\n"
	"        $flag = substr($tag[\'value\'], 0, 1);\n"
	"        if (\'$\' == $flag || \':\' == $flag) {\n"
	"            $value = $this->autoBuildVar($tag[\'value\']);\n"
	"        } else {\n"
	"            $value = \'\\\'\' . $tag[\'value\'] . \'\\\'\';\n"
	"        }\n"
	"        $parseStr = \'<?php \' . $name . \' = \' . $value . \'; ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * define标签解析\n"
	"     * 在模板中定义常量 支持变量赋值\n"
	"     * 格式： {define name=\"\" value=\"\" /}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagDefine($tag, $content)\n"
	"    {\n"
	"        $name = \'\\\'\' . $tag[\'name\'] . \'\\\'\';\n"
	"        $flag = substr($tag[\'value\'], 0, 1);\n"
	"        if (\'$\' == $flag || \':\' == $flag) {\n"
	"            $value = $this->autoBuildVar($tag[\'value\']);\n"
	"        } else {\n"
	"            $value = \'\\\'\' . $tag[\'value\'] . \'\\\'\';\n"
	"        }\n"
	"        $parseStr = \'<?php define(\' . $name . \', \' . $value . \'); ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * for标签解析\n"
	"     * 格式：\n"
	"     * {for start=\"\" end=\"\" comparison=\"\" step=\"\" name=\"\"}\n"
	"     * content\n"
	"     * {/for}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagFor($tag, $content)\n"
	"    {\n"
	"        //设置默认值\n"
	"        $start      = 0;\n"
	"        $end        = 0;\n"
	"        $step       = 1;\n"
	"        $comparison = \'lt\';\n"
	"        $name       = \'i\';\n"
	"        $rand       = rand(); //添加随机数，防止嵌套变量冲突\n"
	"        //获取属性\n"
	"        foreach ($tag as $key => $value) {\n"
	"            $value = trim($value);\n"
	"            $flag  = substr($value, 0, 1);\n"
	"            if (\'$\' == $flag || \':\' == $flag) {\n"
	"                $value = $this->autoBuildVar($value);\n"
	"            }\n"
	"\n"
	"            switch ($key) {\n"
	"                case \'start\':\n"
	"                    $start = $value;\n"
	"                    break;\n"
	"                case \'end\':\n"
	"                    $end = $value;\n"
	"                    break;\n"
	"                case \'step\':\n"
	"                    $step = $value;\n"
	"                    break;\n"
	"                case \'comparison\':\n"
	"                    $comparison = $value;\n"
	"                    break;\n"
	"                case \'name\':\n"
	"                    $name = $value;\n"
	"                    break;\n"
	"            }\n"
	"        }\n"
	"\n"
	"        $parseStr = \'<?php $__FOR_START_\' . $rand . \'__=\' . $start . \';$__FOR_END_\' . $rand . \'__=\' . $end . \';\';\n"
	"        $parseStr .= \'for($\' . $name . \'=$__FOR_START_\' . $rand . \'__;\' . $this->parseCondition(\'$\' . $name . \' \' . $comparison . \' $__FOR_END_\' . $rand . \'__\') . \';$\' . $name . \'+=\' . $step . \'){ ?>\';\n"
	"        $parseStr .= $content;\n"
	"        $parseStr .= \'<?php } ?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * url函数的tag标签\n"
	"     * 格式：{url link=\"模块/控制器/方法\" vars=\"参数\" suffix=\"true或者false 是否带有后缀\" domain=\"true或者false 是否携带域名\" /}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagUrl($tag, $content)\n"
	"    {\n"
	"        $url    = isset($tag[\'link\']) ? $tag[\'link\'] : \'\';\n"
	"        $vars   = isset($tag[\'vars\']) ? $tag[\'vars\'] : \'\';\n"
	"        $suffix = isset($tag[\'suffix\']) ? $tag[\'suffix\'] : \'true\';\n"
	"        $domain = isset($tag[\'domain\']) ? $tag[\'domain\'] : \'false\';\n"
	"        return \'<?php echo url(\"\' . $url . \'\",\"\' . $vars . \'\",\' . $suffix . \',\' . $domain . \');?>\';\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * function标签解析 匿名函数，可实现递归\n"
	"     * 使用：\n"
	"     * {function name=\"func\" vars=\"$data\" call=\"$list\" use=\"&$a,&$b\"}\n"
	"     *      {if is_array($data)}\n"
	"     *          {foreach $data as $val}\n"
	"     *              {~func($val) /}\n"
	"     *          {/foreach}\n"
	"     *      {else /}\n"
	"     *          {$data}\n"
	"     *      {/if}\n"
	"     * {/function}\n"
	"     * @access public\n"
	"     * @param array $tag 标签属性\n"
	"     * @param string $content 标签内容\n"
	"     * @return string\n"
	"     */\n"
	"    public function tagFunction($tag, $content)\n"
	"    {\n"
	"        $name = !empty($tag[\'name\']) ? $tag[\'name\'] : \'func\';\n"
	"        $vars = !empty($tag[\'vars\']) ? $tag[\'vars\'] : \'\';\n"
	"        $call = !empty($tag[\'call\']) ? $tag[\'call\'] : \'\';\n"
	"        $use  = [\'&$\' . $name];\n"
	"        if (!empty($tag[\'use\'])) {\n"
	"            foreach (explode(\',\', $tag[\'use\']) as $val) {\n"
	"                $use[] = \'&\' . ltrim(trim($val), \'&\');\n"
	"            }\n"
	"        }\n"
	"        $parseStr = \'<?php $\' . $name . \'=function(\' . $vars . \') use(\' . implode(\',\', $use) . \') {\';\n"
	"        $parseStr .= \' ?>\' . $content . \'<?php }; \';\n"
	"        $parseStr .= $call ? \'$\' . $name . \'(\' . $call . \'); ?>\' : \'?>\';\n"
	"        return $parseStr;\n"
	"    }\n"
	"}\n"
	"\n"
;
#endif